//	ID : pallab81
// 	PROG : 473
// 	LANG : C++
// 	2011-09-08-17.24.00 Thursday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define foR(i,st,ed) for(int i = st ; i < ed ; ++i )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define fo(i,ed) foR( i , 0 , ed )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait( double seconds ) {
    double endtime = clock()+( seconds* CLOCKS_PER_SEC );
    while( clock() < endtime ) {
        ;
    }
}

int nsongs,tminute,ndisk;
int songs[810];

inline void Read() {
    CI(nsongs);
    CI(tminute);
    CI(ndisk);
    fo(i,nsongs) {
        scanf("%d,",&songs[i]);
    }
}
// kon song ta use kortechi, kon disk ta te record kortechi, capacity koto tuku baki ase
int dp[ 810 ][101][ 101 ];
string line;

inline int go(int current_song, int current_disk, int current_capacity) {
    if( current_song==nsongs ) {
        return 0;
    }
    if( current_disk==ndisk ) {
        return 0;
    }

    int &best = dp[current_song][ current_disk ][current_capacity ];
    if( best!=-1 ) {
        return best;
    }

    best=0;
    // current song ta na niye
    int var1 = go(current_song+1, current_disk, current_capacity);
    best = max(best,var1);
    // current song ta niye
    if( current_capacity >= songs[current_song] ) {
        int var2 = 1+go(current_song+1, current_disk, current_capacity-songs[current_song] );
        best = max( best ,var2 );
    }

    int var3 = go( current_song, current_disk+1, tminute);
    best = max( best ,var3 );

    return best;
}
inline void Proc() {
    SET(dp,-1);
    int var = go(0,0,tminute);
    cout<<line<<var<<"\n";
    line="\n";
}

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("in.txt","rt",stdin);
//#endif
//   cout<<sizeof(dp)/1024/1024<<"\n";
    int cases=1;
    line="";
    for( CI(cases) ; cases ; --cases ) {
        Read();
        Proc();
    }

    return 0;
}
